const auth = {
  setToken: function setToken(token) {
    return sessionStorage.setItem('token', token)
  },
  getToken: function getToken() {
    return sessionStorage.getItem('token')
  },
  removeToken: function removeToken() {
    return sessionStorage.removeItem('token')
  },
  /* userId*/
  setUserId: function setUserId(userId) {
    return sessionStorage.setItem('userId', userId)
  },
  getUserId: function getUserId() {
    return sessionStorage.getItem('userId')
  },
  /* username*/
  setUsername: function setUsername(username) {
    return sessionStorage.setItem('username', username)
  },
  getUsername: function getUsername() {
    return sessionStorage.getItem('username')
  },

  /* roleId*/
  setRoleId: function setRoleId(roleId) {
    return sessionStorage.setItem('roleId', roleId)
  },
  getRoleId: function getRoleId() {
    return sessionStorage.getItem('roleId')
  },
  /* permissionIds*/
  setPermissionIds: function setPermissionIds(permissionIds) {
    return sessionStorage.setItem('permissionIds', JSON.stringify(permissionIds))
  },
  getPermissionIds: function getPermissionIds() {
    return JSON.parse(sessionStorage.getItem('permissionIds'))
  },
  /* permissionCodes*/
  setPermissionCodes: function setPermissionCodes(permissionCodes) {
    return sessionStorage.setItem('permissionCodes', JSON.stringify(permissionCodes))
  },
  getPermissionCodes: function getPermissionCodes() {
    return JSON.parse(sessionStorage.getItem('permissionCodes'))
  }
}

export default auth
